package com.chinasoft.book.service.impl;

import com.chinasoft.book.mapper.BookMapper;
import com.chinasoft.book.mapper.impl.BookMapperImpl;
import com.chinasoft.book.mapper.impl.BookMapperImpl2;
import com.chinasoft.book.service.BookService;
import lombok.Setter;

/**
 * 业务层的实现
 */
@Setter
public class BookServiceImpl implements BookService {
    //    BookMapper bookMapper = new BookMapperImpl();
    BookMapper bookMapper;
    String name;
    Integer age;

    // 提供一个 setter 方法
//    public void setBookMapper(BookMapper bookMapper) {
//        this.bookMapper = bookMapper;
//    }

//    BookMapper bookMapper = new BookMapperImpl2();
    @Override
    public void queryBook() {
        System.out.println("业务层 执行代码");
        System.out.println(this.name);
        // 调用 dao层代码（持久层代码）
        String result = bookMapper.selectById(100);
        System.out.println(result);
    }
}
